#include<bits/stdc++.h>
#define ___ "-------------------------------\n"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int maxn = 2000 + 5;

class Solution {
public:
    int numberOfWays(int startPos, int endPos, int k) {
        int mod = 1000000007;
        int dp[2000 + 5][2000 + 5];
        memset(dp, 0, sizeof(dp));
        int n = abs(startPos - endPos);
        dp[0][0] = 1;
        for (int i = 1; i <= k; i++) {
            for (int j = 0; j <= k + n; j++) {
                dp[j][i] += dp[j + 1][i - 1];
                dp[j][i] %= mod;
                dp[j][i] += (j ? dp[j - 1][i - 1] : dp[j + 1][i - 1]);
                dp[j][i] %= mod;
            }
        }
        return dp[n][k];
    }
};

int main(){
//    ios::sync_with_stdio(false);
//    ifstream cin("data.txt");
//    freopen("data.txt", "r", stdin);
    return 0;
}

/**
 * @date 2022-09-04
 * @brief dp
 */